package com.bruce.starts.demo.commonerror.jdk8;

import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;

/**
 * @author luotuan
 * @Description
 * @create 2021-05-20 15:27
 **/
public class LambdaDemo {
    public static void main(String[] args) {
        Supplier<String> supplier = ()->{
            int i=0;
            String ss = "test";
            return ss+i;
        };
        Supplier<String> supplier2 = String::new;
        Predicate<Integer> positiveNumber = i->i>0;
        Predicate<Integer> evenNumber = i -> i % 2 == 0;
        System.out.println(positiveNumber.and(evenNumber).test(1));
        Consumer<String> print = System.out::println;
        //print.andThen(print).accept(supplier.get());
        Function<String,String> upperCase = String::toUpperCase;
        Function<String, String> duplicate = s -> s.concat(s);
        print.accept(upperCase.andThen(duplicate).apply("ss"));
    }
}
